package org.halk.repository;

import org.halk.pojo.entity.StudentTest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * @Author halk
 * @Date 2023/7/31 21:36
 */
public interface StudentTestRepository extends JpaRepository<StudentTest, Integer> {

    @Query("FROM StudentTest WHERE name = :name")
    StudentTest findByName(String name);

    @Query("update StudentTest set name=:name where id =:id")
    @Modifying
    int updateStudentTest(String name, Integer id);

    @Query(value = "select * FROM student_test WHERE id = :id", nativeQuery = true)
    StudentTest findById(String id);

}
